import { http } from "@/utils/http";
import { Result, arrayResult } from "../types";

type Search = {
  name: string,
  pageNumber: number,
  pageSize: number,
  sortName: string,
  sortType: number
}

type data = {
  id?: number;
  name: string;
  code: string;
  type: number;
  status: number;
  userid: number;
}

// 呼叫设备列表
export const callList = (params?: Search) => {
  return http.request<Result>("get", "/api/call/List", { params });
};

// 新增呼叫设备
export const addCall = (data?: data) => {
  return http.request<Result>("post", "/api/call/Add", { data });
};

// 修改呼叫设备
export const updateCall = (data?: data) => {
  return http.request<Result>("post", "/api/call/Update", { data });
};

// 删除呼叫设备
export const delCall = (id: number) => {
  return http.request<Result>("post", `/api/call/Delete/${id}`, {});
};

// 呼叫设备下拉
export const GetAllCall = (data: any) => {
  return http.request<arrayResult>("get", `/api/call/GetAllCall`, { params: data });
};

// 设备详情
export const getCall = (id: number) => {
  return http.request<any>("get", `/api/call/Get/${id}`);
};